package com.xingkeduo.util;

/**
 * @Author: 中文输入法发挥不稳定的刘川
 * @Date: 19-5-15 下午8:22
 */
public class pageUtil {
    public static int getTotalPage(long allCount, int pageSize) {
        double tp = allCount / (double) pageSize;
        int totalPage = (int) Math.ceil(tp);
        return totalPage;
    }

    public static String getPage(int pageNumber, int pageSize) {
        if (pageNumber < 0 || pageSize < 0) {
            return "";
        }
        long beginRowNum = (pageNumber - 1) * pageSize;
        return "limit " + beginRowNum + "," + pageSize;
    }
}
